// Copyright 2007 the original author or authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package lichen.validator;

import org.apache.tapestry5.Validator;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.MappedConfiguration;

/**
 * 扩展的validator的定义.
 * @author jcai
 * @version $Revision: 225 $
 * @since 0.0.3
 */
public class ValidatorModule {
	/** 弹出的消息 **/
	private static final String VALIDATION__ZH_MESSAGES = "lichen/validator/ValidationMessages_zh_CN";

    /**
     * 实现对field的校验的扩展.
     * @param configuration 配置.
     * @since 0.0.2
     */
    public static void contributeFieldValidatorSource(
            MappedConfiguration<String, Validator> configuration)
    {
    	//针对email的校验
        configuration.add("email", new Email());
    }
	/**
	 * 加入中文的校验信息
	 * @param configuration 配置
	 */
    public void contributeValidationMessagesSource(Configuration<String> configuration)
    {
        configuration.add(VALIDATION__ZH_MESSAGES);
    }
    
}
